package com.example.second.mediator.classes;

import android.util.Log;

import com.example.second.mediator.interfaces.IColleague;
import com.example.second.mediator.interfaces.IMediator;

/**
 * @ClassName: ConcreteColleague1$
 * @Description: java类作用描述
 * @Author: xinya
 * @CreateDate: 2020/12/23$ 14:37$
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class ConcreteColleague1 implements IColleague {
    private static final String TAG = "ConcreteColleague1";
    IMediator mediator = null;

    @Override
    public void setMediator(IMediator mediator) {
        this.mediator = mediator;
        this.mediator.register(this);
    }

    @Override
    public void receive(String message) {
        Log.d(TAG, "receive: " + message);
    }

    @Override
    public void send(String message) {
        mediator.relay(message, this);
    }
}
